//
//  LDCheckCell.m
//  Gift
//
//  Created by 李迪 on 15/11/16.
//  Copyright © 2015年 dllo. All rights reserved.
//

#import "LDCheckCell.h"
#import "BaseHeader.h"

@interface LDCheckCell ()

@property (nonatomic, retain)UIImageView *image;
@property (nonatomic, retain)UILabel *title;
@property (nonatomic, retain)UILabel *content;


@end


@implementation LDCheckCell

- (void)dealloc{
    
    [self.image release];
    [self.content release];
    [self.title release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self carateTabCell];
    }
    
    return self;
}


- (void)carateTabCell{
    
    self.image = [[UIImageView alloc]init];
    [self addSubview:self.image];
    
    UIView *viewX = [[UIView alloc]initWithFrame:CGRectMake(30, (SCREEN_HEIGHT / 4) / 2, SCREEN_WIDTH - 60, 1)];
    viewX.backgroundColor = [UIColor whiteColor];
    self.image.userInteractionEnabled = YES;
    [self.image addSubview:viewX];
    
    self.title = [[UILabel alloc]init];
    self.title.textColor = [UIColor whiteColor];
    self.title.font = [UIFont systemFontOfSize:19];
    self.title.textAlignment = NSTextAlignmentCenter;
    [self.image addSubview:self.title];
    
    self.content = [[UILabel alloc]init];
    self.content.textColor = [UIColor whiteColor];
    self.content.font = [UIFont systemFontOfSize:15];
    self.content.textAlignment = NSTextAlignmentCenter;
    [self.image addSubview:self.content];
    

    
    
    
    [self.image release];
    [viewX release];
    [self.content release];
    [self.title release];
}




-(void)layoutSubviews{
    
    [super layoutSubviews];
    
    self.image.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT / 4);
    self.title.frame = CGRectMake(30, (SCREEN_HEIGHT / 4) / 2 - 25, SCREEN_WIDTH -60, 20);
    self.content.frame = CGRectMake(30, (SCREEN_HEIGHT / 4) / 2 + 10, SCREEN_WIDTH -60, 20);

}


-(void)setModel:(ClassificationModel *)model{
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    
    [self.image sd_setImageWithURL:[NSURL URLWithString:model.cover_image_url]];
    self.title.text = model.title;
    self.content.text = model.subtitle;
}








- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
